package com.demo.servlet.demo;

import javax.servlet.*;
import java.io.IOException;

/**
 * @author ddone
 * @date 2024/3/10-17:40
 */
public class SecondServlet implements Servlet {
    public SecondServlet(){
        System.out.println("1.我是构造器方法");
    }
    @Override
    public void init(ServletConfig config) throws ServletException {
        System.out.println("2.我是初始化方法");
        System.out.println("你好Servlet, 我是第二个Servlet");
        String name = config.getInitParameter("name");
        System.out.println(name);
        ServletContext servletContext = config.getServletContext();
        System.out.println(servletContext.toString());
    }

    @Override
    public ServletConfig getServletConfig() {
        return null;
    }

    @Override
    public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {

    }

    @Override
    public String getServletInfo() {
        return null;
    }

    @Override
    public void destroy() {

    }
}
